package com.haidechizi.tree;

public class Node {

    int value;

    Node left;

    Node right;

    public Node(int value) {
        this.value = value;
    }

    public void frontShow() {
        System.out.println(value);
        if (left != null) {
            this.left.frontShow();
        }
        if (this.right != null) {
            this.right.frontShow();
        }
    }


    public void midShow() {
        if (left != null) {
            left.midShow();
        }
        System.out.println(value);

        if (right != null) {
            right.midShow();

        }
    }

    public void afterShow() {
        if (left != null) {
            left.afterShow();
        }
        if (right != null) {
            right.afterShow();
        }
        System.out.println(value);
    }
}
